const request = ({url, method = "GET"}) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url,
      method,
      success: res => {
        if(res.statusCode === 200) {
          if(res.data.code === 0) {
            resolve(res.data.data)
          }
        }
        reject(res)
      },
      fail: err => {
        reject(err)
      }
    })
  })
}
module.exports = request